<?php

    include_once 'commentmodel.php';
    date_default_timezone_set('Asia/Ho_Chi_Minh');
    $list_tv_cm = lay_thanh_vien_comment();
    
    //them moi comment
    if($_GET["action"] == "addnewcomment"){
        $content = mysql_real_escape_string($_POST["content"]);
        $date = date("Y-m-d H:i:s", time());
        $array = array(
            "id" => "''",
            "post_id" => "'{$_GET["postid"]}'",
            "user_id" => "{$_COOKIE["id"]}",
            "date_comment" => "'{$date}'",
            "content" => "'{$content}'",
            "status" => "1"
        );            
        them_moi_comment($array);       
    }
    if($_GET["action"] == "get_log"){
        get_comment_by_time();
    }
    if($_GET["action"] == "delete_comment"){
        echo xoa_comment($_GET["id"]);
    }
?>
